﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using Metro.Admin.BusinessEntities;
using Metro.Admin.DataAccess;
using Metro.Admin.Services;   

namespace Metro.Admin.Views
{
    public class CreditPresenter : Presenter<ICredit>
    {

        private IAdminService _adminService;
        public CreditPresenter([ServiceDependency] IAdminService adminService)
        {
            _adminService = adminService;
        }


        public override void OnViewLoaded()
        {
            List<Credit> credits = null;
            credits = _adminService.GetCredits();
            View.ShowCredits(credits);
            
            List<Customer> customers = null;
            customers = _adminService.GetCustomers();
            View.ShowCustomers(customers);  

        }

        public override void OnViewInitialized()
        {
            // TODO: Implement code that will be executed the first time the view loads
        }

        public void DeleteCredit(Credit credit)
        {
            _adminService.DeleteCredit(credit); 
        }

        public void CreateCredit(Credit credit)
        {
            _adminService.CreateCredit(credit);  
        }
    }
}




